//
//  MainNavigationController.m
//  HZ12315
//
//  Created by ZRAR on 14/12/4.
//  Copyright (c) 2014年 ZRAR. All rights reserved.
//

#import "MainNavigationController.h"
#import "UINavigationController+SettingColor.h"

@interface MainNavigationController ()<UINavigationControllerDelegate,UINavigationBarDelegate,UIGestureRecognizerDelegate>

@end

@implementation MainNavigationController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self customNavigationBar];
}


#pragma mark --自定义导航栏
-(void)customNavigationBar{
    
    //UIColor *backColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"navtionbar_bg"]];
    [self.navigationBar setBackgroundImage:[UIImage imageNamed:@"navtionbar_bg"] forBarMetrics:UIBarMetricsDefault];
    [self.navigationBar setBarStyle:UIBarStyleDefault];
    //[self.navigationBar setShadowImage:[UIImage new]];
    self.navigationBar.translucent = NO;
    //侧滑返回手势
    self.interactivePopGestureRecognizer.delegate = self;
}


-(void)popself
{
    [self.view endEditing:YES];
    [self popViewControllerAnimated:YES];

}

//状态栏风格  白色字体
- (UIStatusBarStyle)preferredStatusBarStyle{
    
    
    return UIStatusBarStyleDefault;
}


- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{

    viewController.hidesBottomBarWhenPushed = YES;
    
    [super pushViewController:viewController animated:animated];
    viewController.hidesBottomBarWhenPushed = NO;

}

- (UIViewController *)popViewControllerAnimated:(BOOL)animated{
    
    UIViewController *viewCol = [super popViewControllerAnimated:animated];
    
    if (self.viewControllers.count == 1) {
        
        viewCol.tabBarController.tabBar.hidden = NO;
    }else{
        
        viewCol.tabBarController.tabBar.hidden = YES;
    }
    
    return viewCol;
}

- (void)dealloc{
    
   // ALog(@"%@被销毁",self);
}

@end
